package com.hspedu.newData.dmsxl.字符串;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-24 
 * @Version: 1.0
 */

public class LC2942查找包含给定字符的单词 {

    public List<Integer> findWordsContaining(String[] words, char x) {

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < words.length; i++) {

            if (check(words[i],x)){
                list.add(i);
            }
        }
        return list;

    }

    public boolean check(String s,char x){
        for (int i = 0; i < s.length(); i++) {
            if (x==s.charAt(i)){
                return true;
            }
        }
        return false;
    }
}
